10 CLS:PRINT:PRINT:PRINT " AHD-2 ... Applied Hydraulic Design Program "
15 PRINT:PRINT:CLOSE
16 '
17 ' Original program author: Dr. M. Dougal, Civil Engr., ISU
18 ' Converted from Fortran to Basic by Dr. R.G. Allen, Civil Engr., ISU:1/85
19 ' Circular Sections and specific force added 1/85.
20 '
21 PRINT " Enter the name of your data file to read or an S for screen input (E to end)"
25 INPUT FILE$:IF FILE$ = "E" THEN GOTO 2000
26 OPEN "SCRN:" FOR OUTPUT AS #2
27 PRINT:PRINT " Do you wish output to be routed to a" :PRINT " (P) Printer and screen, or":PRINT " (F) Output file and screen, or":PRINT " (S) Screen only"
28 INPUT O$:IF O$="F" THEN 30 ELSE IF O$="P" THEN 29 ELSE IF O$<>"S" THEN 27 ELSE GOTO 35
29 OPEN "LPT1:" FOR OUTPUT AS #3:GOTO 35
30 PRINT:INPUT " Output file name ";OF$:OPEN OF$ FOR OUTPUT AS #3
35 IF FILE$ <> "S" THEN OPEN FILE$ FOR INPUT AS #1
40 IF FILE$ <> "S" THEN INPUT #1,ICALC,ID$:GOTO 150
50 PRINT " Code Type of Problems Solved":PRINT "(ICALC)"
60 PRINT " 1 Specific energy curve data and critical depth, for given Q"
70 PRINT " 2 Normal depth and S-Q curve data up to Normal Depth for given Q"
80 PRINT " 3 Both 1 and 2 solved in one run
90 PRINT " 4 S-Q curve computed for given range of depths"
100 PRINT " 5 Discharge and critical depth computed for given normal depth"
110 PRINT " 6 Water surface profile computed for given discharge, starting"
120 PRINT " depth and desired end depth (Direct Step Method)"
130 PRINT:PRINT:INPUT " Enter the desired ICALC value (1-6) ",ICALC
155 IF FILE$ <> "S" THEN INPUT #1,JTYP,B,Z,RCN,SL,QD,DIN,DELD1,DFIN,DST,DELD2,STAIN,ELEVIN:GOTO 300
160 PRINT "Enter 1 for a uniform, trapezoidal or rectangular channel"
162 PRINT " 2 for a depressed culvert invert "
163 PRINT " or 3 for a circular cross-section":INPUT JTYP
170 IF JTYP < 3 THEN INPUT "Enter the bottom width of the channel in feet (B) ",B
172 IF JTYP = 3 THEN INPUT "Enter the diameter of circular channel in feet (B) ",B
180 IF JTYP < 3 THEN INPUT "Enter the sideslope, horiz. to vert. (0 is vertical) (Z) ",Z
190 INPUT "Enter the value of Manning's roughness coefficient (RCN) ",RCN
200 INPUT "Enter the slope of invert of channel, ft/ft (positive,0,or neg) (SL) ",SL
210 INPUT "Enter the design discharge (0 if unknown for ICALC=4 or 5) (QD) ",QD
220 INPUT "Enter the initial depth to begin calculations (ICALC=1-5) (not 0) (DIN) ",DIN
230 PRINT "Enter the depth increment for computing successive values for S-Q ":INPUT " (i.e. 0.50 for mild and 0.25 for steep slopes) (DELD1) ",DELD1
240 PRINT "For ICALC =1-5 enter the max. depth for calculations (B if unknown)"
250 PRINT "For ICALC = 6 enter the depth at which water surface calculations stop":INPUT " (Usually normal depth) (DFIN) ",DFIN:IF ICALC < 6 THEN GOTO 295
260 INPUT "Enter the starting depth for ICALC = 6 (water surface profile) (DST) ",DST
270 INPUT "Enter the increment of depth (.25-.5 for mild, .1-.25 for steep (DELD2) ",DELD2
280 PRINT "Enter the initial stationing of the channel at the point where WSP computations"
290 INPUT "are to begin (at depth=DST). Stationing should proceed upstream (STAIN) ",STAIN
295 INPUT "Enter the elevation of the channel invert at the initial station (ELEVIN) ",ELEVIN
300 '
305 IF B < 0 THEN 1900
310 IF B=0 THEN 320 ELSE GOTO 330
320 IF Z<0 THEN 1900
330 I=2:GOSUB 332:IF O$<>"S" THEN I=3:GOSUB 332
331 GOTO 475
332 PRINT #I," CE 472. APPLIED HYDRAULIC DESIGN (AHD-2)"
340 PRINT #I," SOLUTION OF NORMAL DEPTH, CRITICAL DEPTH, AND WATER SURFACE "
350 PRINT #I," PROFILE PROBLEMS IN SIMPLE CHANNEL SECTIONS"
530 ' PRINT OUT THE TYPE OF PROBLEM WHICH IS BEING SOLVED
540 '
550 IF ICALC=1 THEN GOTO 600 ELSE IF ICALC=2 THEN GOTO 610 ELSE IF ICALC=3 THEN GOTO 620
560 IF ICALC=4 THEN GOTO 630 ELSE IF ICALC=5 THEN GOTO 640 ELSE IF ICALC=6 THEN GOTO 650
600 PRINT "Calculate the Specific Energy Curve and Critical Depth for a Given Discharge":GOTO 720
610 PRINT "Calculate S-Q Curve Data and Normal Depth for a Given Discharge and Channel":GOTO 1060
620 PRINT "Calculate the Specific Energy Curve, Critical Depth, S-Q Curve and Normal Depth":GOTO 720
630 PRINT "Calculate S-Q Curve Data for Given Range of Depths and Channel Characteristics":GOTO 1300
640 PRINT "Calculate Design Discharge and Specific Energy Data and Critical Discharge":PRINT" for a given Normal Depth of Flow and Channel Characteristics":GOTO 1300
650 PRINT "Calculate a Water Surface Profile for an A,C,H,M, or S Curve for a Given ":PRINT "Discharge, Starting Depth and Channel Characteristics":GOTO 1600
720 '
730 ' Compute Specific Energy Curve and Critical Depth
740 '
750 IF QD <= 0 THEN 760 ELSE 770
760 PRINT USING "STOP QD = ###.## CFS. DIN = #### feet";QD,DIN:GOTO 1900
770 IF DIN <=0 THEN GOTO 760
780 I=2:GOSUB 782:IF O$ <>"S" THEN I=3:GOSUB 782
781 GOTO 820
782 PRINT#I,:PRINT#I,:PRINT #I," Computation of Specific Energy and Force Data and Critical Depth":PRINT#I,
790 PRINT #I,"Depth Elev. Area Top Mean Veloc. Vel. Ratio Spec. Spec. Elev.TH."
800 PRINT #I," W.S. Width Depth Head VH/DM Head Force Line "
810 PRINT #I," ft. ft. sq.ft. ft. ft. fps ft. ft. lb. ft. ":RETURN
820 D=DIN:DHOLD=DELD1/2
830 FOR N = 1 TO 100:GOSUB 5000:IF JTYP=3 AND D>B THEN 890